package twoD.hofem;

/**Implementing the bilinear form three (Bf3)
 * bf3(u, v) = int u(x) * v(x) + u'(x)*v'(x) dx  
 * where int stands for integration over the domain of u, v. 
 * 
 * Author:Team4
 */
public class H1ScalarProduct implements BilinearFormOnRToR {
	public double valueAt(FunctionRToR u, FunctionRToR v) {
		FunctionRToR p = FMath.multiply(u, v);
		FunctionRToR uprime = new Derivative(u);
		FunctionRToR vprime = new Derivative(v);
		FunctionRToR w = FMath.multiply(uprime, vprime);
		FunctionRToR q = FMath.add(p, w);
		return Integrator.integrate(q);
	}
}